package com.everyline.lib_base.view

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.viewpager.widget.ViewPager
import java.util.jar.Attributes

/**
 *creatd by 天天挂线
 *email:746608431@qq.com
 *on 2020/7/7
 *描述:TODO
 */
class NoScrollViewPager @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
    ViewPager(context, attrs) {

    private var noScroll = false


    fun setNoScroll(noScroll: Boolean) {
        this.noScroll = noScroll
    }

    override fun onTouchEvent(ev: MotionEvent?): Boolean {
        return if (noScroll) {
            false
        } else super.onTouchEvent(ev)

    }

    override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
        return if (noScroll) false else super.onInterceptTouchEvent(ev)
    }

}